﻿<%@ Page Language="C#" MasterPageFile="~/Hospitals/Master/HospitalsMaster.Master"
    AutoEventWireup="true" CodeBehind="PurchaseOrderDetailAdd.aspx.cs" Inherits="HZ.DrugTrade.Web.Hospitals.Procurement.PurchaseOrderDetailAdd"
    Title="无标题页" %>

<%@ Register Src="../../Controls/ucIsBasicRemedy.ascx" TagName="ucIsBasicRemedy" TagPrefix="uc1" %>


<asp:Content ID="Content1" ContentPlaceHolderID="head" runat="server">
    <script type="text/javascript">
        jQuery(function () {

            Modify_Click();

        });
     function Modify_Click(it) {
               //sender = document.getElementById(it);
               // i = sender.value; //采购价
         // var e=eventsrcElement;
                index = sender.parentNode.parentNode.rowIndex; //行号
                gdview = document.getElementById("ctl00_ContentPlaceHolder1_gvwProduceCatalog"); //列表
                ProcureCatalogID = gdview.rows[index].cells[1].childNodes[0].data; //产品编号
                i = gdview.rows[index].cells[1].childNodes[0].data;
                $.ajax({
                    type: "GET",
                    url: "HospitalEvent.ashx",
                    data: "ProcureCatalogID=" + ProcureCatalogID + "&i=" + i ,
                    beforeSend: function () { },
                    complete: function () { },
                    error: function (data) { alert(data.responseText); },
                    success: function (data) {
                        var list = "";
                        list = data;
                        var selected = list.substring(list.indexOf("$"), list.Length);
                        list = list.replace(selected, "");
                        selected = selected.replace("$", "")
                        //gdview.rows[index].cells[11].title = list;
                        gdview.title = list;
                        //                    .children[0].childNodes[3]
                        //if (index + 1 < 10) {
                        //    var cot = index + 1;
                        //    var id = "ctl00_ContentPlaceHolder1_gvwPurchaseOrderDetail_ctl0" + cot + "_StrengthDiv "
                        //}
                        //else {
                        //    var cot = index + 1;
                        //    var id = "ctl00_ContentPlaceHolder1_gvwPurchaseOrderDetail_ctl" + cot + "_StrengthDiv "
                        //}
                        var id = "StrengthDiv";
                        var strclass = "is" + selected + "";
                        //document.getElementById("StrengthDiv").className = strclass;
                        $("#ctl00_ContentPlaceHolder1_StrengthDiv").attr("class", strclass);
                        $("#ctl00_ContentPlaceHolder1_StrengthDiv").attr("title", list);
                    }
                });
     }

    </script>
    <style type="text/css">
        .style1 {
            width: 98px;
        }
    </style>
</asp:Content>
<asp:Content ID="Content2" ContentPlaceHolderID="ContentPlaceHolder1" runat="server">
    <div id="tabnav">
        <ul>
            <li class="active"><a href="javascript:void(0);">选择产品</a></li>
        </ul>
    </div>
    <div id="tabcontent">
        <table class="querylist">
            <tr>
                <td>
                    <table class="querylist">
                        <tr>
                            <td align="right">产品名称：
                            </td>
                            <td align="left">
                                <asp:TextBox ID="txtGoodsName" runat="server"></asp:TextBox>
                            </td>
                            <td align="right" class="style1">规格型号：
                            </td>
                            <td align="left">
                                <asp:TextBox ID="txtOutLook" runat="server"></asp:TextBox>
                            </td>
                            <td align="right">材质：
                            </td>
                            <td align="left">
                                <asp:TextBox ID="txtMaterial" runat="server"></asp:TextBox>
                            </td>
                        </tr>
                        <tr>
                            <td align="right">拼音码：
                            </td>
                            <td align="left">
                                <asp:TextBox ID="txtpinyincode" runat="server"></asp:TextBox>
                            </td>
                            <td align="right">
                                <asp:Label Text="项目：" ID="lblProjectid" runat="server" />
                            </td>
                            <td align="left">
                                <asp:DropDownList ID="ddlProjectid" runat="server">
                                    <asp:ListItem Value="0002">2014年内蒙古自治区网上高值医用耗材阳光采购项目</asp:ListItem>
                                    <asp:ListItem Value="0001">2012年内蒙古自治区网上医用耗材采购项目</asp:ListItem>
                                </asp:DropDownList>
                            </td>
                        </tr>
                        <asp:Literal runat="server" ID="ltlAdvance" Text="&lt;tbody id='advance' style='display:none'&gt;"></asp:Literal>
                        <tr>
                            <%--<td align="right">
                                拼音码：
                            </td>
                            <td align="left">
                                <asp:TextBox ID="txtPinyinCode" runat="server"></asp:TextBox>
                            </td>--%>
                            <td align="right" class="style1">&nbsp;最小计量单位：
                            </td>
                            <td align="left">
                                <asp:TextBox ID="txtUnit" runat="server"></asp:TextBox>
                            </td>
                            <td align="right">&nbsp;包装单位：
                            </td>
                            <td align="left">
                                <asp:TextBox ID="txtPackUnit" runat="server" MaxLength="5" Width="108px"></asp:TextBox>
                            </td>
                            <td align="right">&nbsp;生产企业：
                            </td>
                            <td align="left">
                                <asp:TextBox ID="txtProduceCompany_SC" runat="server"></asp:TextBox>
                            </td>

                        </tr>
                        <tr>
                            <td align="right">&nbsp;配送企业：
                            </td>
                            <td align="left">
                                <asp:TextBox ID="txtCompany_PS" runat="server"></asp:TextBox>
                            </td>
                            <td align="right" class="style1">&nbsp;投标企业：
                            </td>
                            <td align="left">
                                <asp:TextBox ID="txtCompany_TB" runat="server"></asp:TextBox>
                            </td>
                        </tr>
                        <tr>
                            <%--<uc1:ucIsBasicRemedy ID="ucIsBasicRemedy1" runat="server" />--%>
                            <td align="left"></td>
                            <td align="right">&nbsp;</td>
                            <td align="left">&nbsp;</td>
                            <td align="right" class="style1">&nbsp;</td>
                            <td align="left">&nbsp;</td>
                        </tr>
                    </table>
                </td>
                <td width="100px">
                    <hz:HzButton ID="btnQuery" runat="server" Text="查询" OnClick="btnQuery_Click" CssClass="searchbtn" />
                    <hz:HzLinkButton ID="lbnSwitch" runat="server" CommandArgument="simple" OnClick="lbnSwitch_Click"
                        Text="高级查询"></hz:HzLinkButton>
                </td>
            </tr>
        </table>
    </div>
    <asp:GridView ID="gvwProduceCatalog" CssClass="mainlist" runat="server" AutoGenerateColumns="False"
        DataKeyNames="ProcureCatalogID,CompanyID_PS,CompanyID_TB" EmptyDataText="该医疗机构暂无可采购的产品！" AllowPaging="True" OnRowDataBound="gvwProduceCatalog_RowDataBound">
        <PagerSettings Visible="False" />
        <Columns>
            <asp:TemplateField HeaderText="序号">
                <ItemTemplate>
                    <%#Container.DataItemIndex + 1  %>
                </ItemTemplate>
                <HeaderStyle Width="30px" />
            </asp:TemplateField>
            <asp:BoundField DataField="ProcureCatalogID" HeaderText="产品编号"  HeaderStyle-Width="0px"/>
            <asp:TemplateField HeaderText="数量">
                <ItemTemplate>
                    <asp:TextBox ID="txtCount" runat="server" Width="40px" oncontextmenu="javascript:return false;"
                        onblur="javascript:return check_isnum();" onkeydown="javascript:return check_isnum();"
                        MaxLength="5" ToolTip="整数类型(格式如10)" Enabled='<%# (Eval("CompanyID_PS")== "" || Convert.ToDecimal( Eval("Price")).ToString("F")== "0.00")?false:true %>'></asp:TextBox>
                </ItemTemplate>
            </asp:TemplateField>
            <asp:TemplateField HeaderText="采购价">
                <ItemTemplate>
                    <asp:Label ID="lblPrice" runat="server" Text='<%#HZ.DrugTrade.Web.Function.FormPrice(Eval("ProjectID"), Eval("Price")) %>'></asp:Label>
                </ItemTemplate>
            </asp:TemplateField>
             <asp:TemplateField HeaderText="位次">
                <ItemTemplate>
                 <div  id="StrengthDiv"   runat="server"  > </div>
                </ItemTemplate>
            </asp:TemplateField>
            <asp:TemplateField HeaderText="采购限价">
                <ItemTemplate>
                    <asp:Label ID="lblProcurePrice" runat="server" Text='<%#HZ.DrugTrade.Web.Function.FormPrice(Eval("ProjectID"), Eval("ProcurePrice")) %>'></asp:Label>
                </ItemTemplate>
            </asp:TemplateField>
           
            <asp:BoundField DataField="GoodsName" HeaderText="产品名称" />
            <asp:BoundField DataField="Outlookc" HeaderText="规格型号" />
            <asp:BoundField DataField="Material" HeaderText="材质" NullDisplayText="无" />
            <asp:BoundField DataField="unitcount" HeaderText="最小计价单位" />
            <%--<asp:BoundField DataField="PackUnit" HeaderText="最小零售包装单位" />--%>
            <asp:BoundField DataField="QualityLevel" HeaderText="产品类别" />
            <asp:BoundField DataField="CompanyName_SC_tb" HeaderText="生产企业(代理)" />
            <%--<asp:BoundField DataField="CompanyName_TB" HeaderText="投标企业" />--%>
            <asp:BoundField DataField="PackCount" HeaderText="建议采购数量" />
            <asp:BoundField DataField="CompanyName_PS" HeaderText="配送企业" />
            <%--<asp:TemplateField HeaderText="产品属性">
                <ItemTemplate>
                    <%# HZ.DrugTrade.Web.Function.FormatDrugSource( Eval("SortSource")) %>
                </ItemTemplate>
                <HeaderStyle Width="60px" />
            </asp:TemplateField>
             <asp:TemplateField HeaderText="产品类别">
                <ItemTemplate>
                    <%# HZ.DrugTrade.Web.Function.FormatDrugBasicRemedy(Eval("IsBasicRemedy"))%>
                </ItemTemplate>
                <HeaderStyle Width="60px" />
            </asp:TemplateField>--%>
            <asp:TemplateField HeaderText="操作">
                <ItemTemplate>
                    <hz:HzLinkButton ID="btnSelect" runat="server" OnClientClick='<%# GetURLScript("PurchaseCompanyUpdate.aspx?procureCatalogId="+Eval("ProcureCatalogID")+"&CompanyID_PS="+Eval("CompanyID_PS"))%>'
                        CausesValidation="false" Text='<img src="../../lib/images/setting.gif" align="middle" alt="" >设置配送'
                        ToolTip="点击进入修改配送企业" ModuleNo="产品库管理" OperateType="编辑" />
                </ItemTemplate>
                <HeaderStyle Width="65px" />
            </asp:TemplateField>
            <asp:TemplateField>
                <HeaderTemplate>
                    <input id="addTable_chkAll" name="chkAll" type="checkbox" onclick="SelectAllCheckboxes(this, 'ctl00_ContentPlaceHolder1_gvwProduceCatalog', 'addTable_chkAll'); " />
                </HeaderTemplate>
                <ItemTemplate>
                    <asp:CheckBox ID="checkbox1" onclick="chkChecked(this,'ctl00_ContentPlaceHolder1_gvwProduceCatalog','addTable_chkAll');" runat="server" Enabled='<%# (Eval("CompanyID_PS")== "" || Convert.ToDecimal( Eval("Price")).ToString("F")== "0.00")?false:true %>' />
                </ItemTemplate>
                <HeaderStyle Width="25px" />
            </asp:TemplateField>
        </Columns>
    </asp:GridView>
    <div class="page">
        <webdiyer:AspNetPager ID="AspNetPager1" runat="server" OnPageChanged="AspNetPager1_OnPageChanged">
        </webdiyer:AspNetPager>
    </div>
    <div class="listip">
        <ul>
            <li>提示:<span style="color: Red;"> 选择需要采购的产品，点击“加入采购单”,采购完成后点击“制单完成”。<br />
                &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;
            “数量”不能填写的原因：其一，没有选择配送企业；其二，没有设置采购价。<br />
                &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; 建议采购量为企业提供的整包装供货数量。填写采购数量时建议按整包装数量的倍数填写,。例如：建议采购量为50，采购数量填写50或100等</span><ul>
                </ul>
            </li>
        </ul>
    </div>
    <div class="listctrl">
        <hz:HzButton ID="btnAdd" runat="server" Text="加入采购单" OnClick="btnAdd_Click" OnClientClick="return checkSelectedItems('ctl00_ContentPlaceHolder1_gvwProduceCatalog','请至少选择一个产品！');"
            CssClass="btn" ToolTip="将所选产品加入采购单" />
        &nbsp;
        <hz:HzButton ID="btnFinish" runat="server" Text="制单完成" OnClick="btnFinish_Click"
            CssClass="btn" ToolTip="结束产品的选择，回到采购单页面" />
    </div>

</asp:Content>
